class Pet:
    def __init__(self, name, species, price):
        self.name = name
        self.species = species
        self.price = price

    def __str__(self):
        return f"{self.name} ({self.species}) - ${self.price}"


class Customer:
    def __init__(self, name, balance):
        self.name = name
        self.balance = balance
        self.pets = []

    def buy_pet(self, pet):
        if self.balance >= pet.price:
            self.balance -= pet.price
            self.pets.append(pet)
            print(f"{self.name} bought {pet.name}!")
        else:
            print(f"{self.name} doesn't have enough money to buy {pet.name}.")

    def __str__(self):
        pet_names = ', '.join([pet.name for pet in self.pets]) or "No pets yet"
        return f"Customer: {self.name}, Balance: ${self.balance}, Pets: {pet_names}"


class PetStore:
    def __init__(self, name):
        self.name = name
        self.inventory = []

    def add_pet(self, pet):
        self.inventory.append(pet)
        print(f"{pet.name} ({pet.species}) added to the store.")

    def show_inventory(self):
        if self.inventory:
            print(f"{self.name} Inventory:")
            for pet in self.inventory:
                print(f" - {pet}")
        else:
            print(f"{self.name} has no pets in inventory.")

    def sell_pet(self, pet_name, customer):
        for pet in self.inventory:
            if pet.name == pet_name:
                customer.buy_pet(pet)
                self.inventory.remove(pet)
                print(f"{pet.name} has been sold.")
                return
        print(f"{pet_name} is not available in the store.")

    def __str__(self):
        return f"Pet Store: {self.name}, Pets Available: {len(self.inventory)}"


# 示例用法
if __name__ == "__main__":
    # 创建商店
    store = PetStore("Happy Paws")

    # 添加宠物到商店
    store.add_pet(Pet("Bella", "Dog", 500))
    store.add_pet(Pet("Milo", "Cat", 300))
    store.add_pet(Pet("Charlie", "Parrot", 150))

    # 显示商店库存
    store.show_inventory()

    # 创建顾客
    customer = Customer("Alice", 800)
    print(customer)

    # 顾客购买宠物
    store.sell_pet("Bella", customer)
    print(customer)

    # 显示更新后的库存
    store.show_inventory()

    # 顾客尝试购买余额不足的宠物
    store.sell_pet("Milo", customer)
    print(customer)
